/*

Project : autoguard-center
Desc :


*/

#include <QDir>
#include <iostream> /* std:cout */
#include "globals.h"

bool SearchAutoGuardFolder(QString  device);

void SearchStorages()
{
    /* Linux */

QDir dir("/media");
    if (!dir.exists())
        qWarning("Cannot find the example directory");

    dir.setFilter(QDir::Dirs | QDir::NoSymLinks|QDir::NoDotAndDotDot);
    dir.setSorting(QDir::Name);

    QFileInfoList list = dir.entryInfoList();
    for (int i = 0; i < list.size(); ++i)
    {
        QFileInfo fileInfo = list.at(i);
        std::cout << qPrintable(QString("%1 %2").arg(fileInfo.size(), 10).arg(fileInfo.fileName()));
        std::cout << std::endl;

        /* Try fo find Autoguard folder */

        if( SearchAutoGuardFolder( fileInfo.absoluteFilePath() ) == true )
        {


        }

    }
}

bool SearchAutoGuardFolder(QString  device)
{
    /* Linux */

QString folder = device + "/AutoGuard";
QDir dir(folder);

    if (!dir.exists())
    {
          return(false);
    }

    qWarning("YES !!!! find directory : ");
    qWarning( folder.toUtf8());
    return(true);
}
